;+
; NAME:
;  hod_plotwprp
; PURPOSE:
;  Makes a plot of wp vs rp overplotting best model and MCMC draws
; CALLING SEQUENCE: 
;  hod_plotwprp,savfile,[/zheng,outfile=outfile]
;-
pro hod_plotwprp,savfile,zheng=zheng,outfile=outfile,ndraw=ndraw

if n_elements(savfile) eq 0 then begin
    splog,"Must specify savfile"
    return
endif

restore,savfile

if n_elements(outfile) gt 0 then $
  ja_plotconfig,outfile=outfile,xsize=16,ysize=14

if n_elements(ndraw) eq 0 then ndraw=50

zhengpar=[11.83,0.30,11.53,13.02,0.97]

ja_plot,rp_obs,wp_obs,psym=3,xtitle='$r_p$',ytitle='$w_p$',/xlog,/ylog

m=max(lik[nburn:nburn+nsamp-1],wm)

q=floor(randomu(seed,ndraw)*nsamp)+nburn

for idraw=0,ndraw-1 do begin
    wpmod=hod_getmod(samps[*,q[idraw]],parfile)
    oplot,wpmod.r_p,wpmod.w_p_sum,col=djs_icolor('grey')
endfor

bmod=hod_getmod(samps[*,nburn+wm],parfile)
oplot,bmod.r_p,bmod.w_p_sum,col=fsc_color('Orange Red',101),thick=!p.thick*1.5


if keyword_set(zheng) then begin
    zmod=hod_getmod(zhengpar,parfile)
    oplot,zmod.r_p,zmod.w_p_sum,col=fsc_color('Dodger Blue',100),linestyle=2,thick=!p.thick*1.5
endif

oploterror,rp_obs,wp_obs,wperr_obs,psym=4,/nohat,col=fsc_color('purple',102),errcol=fsc_color('purple',102)

if n_elements(outfile) gt 0 then ja_plotconfig,/close

end


    





